package main

import (
	"GateWay/api/etc"
	"GateWay/api/internal/config"
	"GateWay/api/internal/handler"
	"GateWay/api/internal/svc"
)

func main() {
	var c config.Config
	config.InitConfig(&c)

	go etc.DiscoverEtcdService(&c.Etcd)

	handler.SC = svc.NewServiceContext(c)
	// 创建并启动网关
	Server := handler.NewGateway(handler.SC)
	if err := Server.Init(); err != nil {
		panic(err)
	}

	if err := Server.Run(); err != nil {
		panic(err)
	}
}
